from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import User

@receiver(post_save, sender=User)
def handle_user_save(sender, instance, created, **kwargs):
    if created and instance.user_type == 'chef':
        # 自动创建厨师档案（需确保chefs应用已正确配置）
        from apps.chefs.models import Chef
        Chef.objects.create(user=instance)